home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / lisp / language / european.el.z / european.el
Encoding:
Text File  |  1998-05-21  |  13.2 KB  |  374 lines

  1. ;;; european.el --- Support for European languages
  2.  
  3. ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
  4. ;; Licensed to the Free Software Foundation.
  5. ;; Copyright (C) 1997 MORIOKA Tomohiko
  6.  
  7. ;; Keywords: multilingual, European
  8.  
  9. ;; This file is part of XEmacs.
  10.  
  11. ;; XEmacs is free software; you can redistribute it and/or modify it
  12. ;; under the terms of the GNU General Public License as published by
  13. ;; the Free Software Foundation; either version 2, or (at your option)
  14. ;; any later version.
  15.  
  16. ;; XEmacs is distributed in the hope that it will be useful, but
  17. ;; WITHOUT ANY WARRANTY; without even the implied warranty of
  18. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  19. ;; General Public License for more details.
  20.  
  21. ;; You should have received a copy of the GNU General Public License
  22. ;; along with XEmacs; see the file COPYING.  If not, write to the Free
  23. ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  24. ;; 02111-1307, USA.
  25.  
  26. ;;; Commentary:
  27.  
  28. ;; For Europeans, five character sets ISO8859-1,2,3,4,9 are supported.
  29.  
  30. ;;; Code:
  31.  
  32. ;; For syntax of Latin-1 characters.
  33. (loop for c from 64 to 127              ; from ',A@(B' to ',A(B'
  34.       do (modify-syntax-entry (make-char 'latin-iso8859-1 c) "w"))
  35.  
  36. (modify-syntax-entry (make-char 'latin-iso8859-1 32) "w") ; no-break space
  37. (modify-syntax-entry ?,AW(B "_")
  38. (modify-syntax-entry ?,Aw(B "_")
  39.  
  40. ;; For syntax of Latin-2
  41. (loop for c in '(?,B!(B ?,B#(B ?,B%(B ?,B&(B ?,B)(B ?,B*(B ?,B+(B ?,B,(B ?,B.(B ?,B/(B ?,B1(B ?,B3(B ?,B5(B ?,B6(B ?,B9(B ?,B:(B ?,B;(B ?,B<(B)
  42.       do (modify-syntax-entry c "w"))
  43.  
  44. (loop for c from 62 to 126
  45.       do (modify-syntax-entry (make-char 'latin-iso8859-2 c) "w"))
  46.  
  47. (modify-syntax-entry (make-char 'latin-iso8859-2 32) "w") ; no-break space
  48. (modify-syntax-entry ?,BW(B ".")
  49. (modify-syntax-entry ?,Bw(B ".")
  50.  
  51. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  52. ;;; EUROPEANS
  53. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  54.  
  55. ;; (define-prefix-command 'describe-european-environment-map)
  56. ;; (define-key-after describe-language-environment-map [European]
  57. ;;   '("European" . describe-european-environment-map)
  58. ;;   t)
  59.  
  60. ;; (define-prefix-command 'setup-european-environment-map)
  61. ;; (define-key-after setup-language-environment-map [European]
  62. ;;   '("European" . setup-european-environment-map)
  63. ;;   t)
  64.  
  65. ;; Setup for LANGAUGE which uses one-byte 8-bit CHARSET, one-byte
  66. ;; 8-bit CODING-SYSTEM, and INPUT-METHOD.
  67. (defun setup-8-bit-environment (language charset coding-system input-method)
  68.   (setup-english-environment)
  69.   (set-default-coding-systems coding-system)
  70.   ;; (setq coding-category-iso-8-1 coding-system
  71.   ;;       coding-category-iso-8-2 coding-system)
  72.   (set-coding-category-system 'iso-8-1 coding-system)
  73.   (set-coding-category-system 'iso-8-2 coding-system)
  74.  
  75.   ;; (if charset
  76.   ;;     (let ((nonascii-offset (- (make-char charset) 128)))
  77.   ;;       ;; Set up for insertion of characters in this character set
  78.   ;;       ;; when codes 0200 - 0377 are typed in.
  79.   ;;       (setq nonascii-insert-offset nonascii-offset)))
  80.  
  81.   (if input-method
  82.       (setq default-input-method input-method))
  83.  
  84.   ;; If this is a Latin-N character set, set up syntax for it in
  85.   ;; single-byte mode.  We can't use require because the file
  86.   ;; must be eval'd each time in case we change from one Latin-N to another.
  87.   ;; (if (string-match "^Latin-\\([1-9]\\)$" language)
  88.   ;;     (load (downcase language) nil t))
  89.   )
  90.  
  91. ;; Latin-1 (ISO-8859-1)
  92.  
  93. ;; (make-coding-system
  94. ;;  'iso-latin-1 2 ?1
  95. ;;  "ISO 2022 based 8-bit encoding (MIME:ISO-8859-1, Compound Text Encoding)"
  96. ;;  '((ascii t) (latin-iso8859-1 t) nil nil
  97. ;;    nil ascii-eol ascii-cntl nil nil nil nil nil nil nil nil nil t))
  98.  
  99. ;; (define-coding-system-alias 'iso-8859-1 'iso-latin-1)
  100. ;; (define-coding-system-alias 'latin-1 'iso-latin-1)
  101. ;; (define-coding-system-alias 'ctext 'iso-latin-1)
  102.  
  103. (defun setup-latin1-environment ()
  104.   "Set up multilingual environment (MULE) for European Latin-1 users."
  105.   (interactive)
  106.   (setup-8-bit-environment "Latin-1" 'latin-iso8859-1 'iso-8859-1
  107.                "latin-1-prefix"))
  108.  
  109. (set-language-info-alist
  110.  "Latin-1" '((setup-function . (setup-latin1-environment
  111.                 . setup-european-environment-map))
  112.          (charset . (ascii latin-iso8859-1))
  113.          (coding-system . (iso-8859-1))
  114.          (sample-text
  115.           . "Hello, Hej, Tere, Hei, Bonjour, Gr,A|_(B Gott, Ciao, ,A!(BHola!")
  116.          (documentation . ("\
  117. These languages are supported with the Latin-1 (ISO-8859-1) character set:
  118.  Danish, Dutch, English, Faeroese, Finnish, French, German, Icelandic,
  119.  Irish, Italian, Norwegian, Portuguese, Spanish, and Swedish.
  120. " . describe-european-environment-map))
  121.          ))
  122.  
  123. (set-language-info-alist
  124.  "German" '((setup-function . (setup-latin1-environment
  125.                 . setup-european-environment-map))
  126.          (charset . (ascii latin-iso8859-1))
  127.          (coding-system . (iso-8859-1))
  128.          (tutorial . "TUTORIAL.de")
  129.          (sample-text
  130.           . "Hello, Hej, Tere, Hei, Bonjour, Gr,A|_(B Gott, Ciao, ,A!(BHola!")
  131.          (documentation . ("\
  132. These languages are supported with the Latin-1 (ISO-8859-1) character set:
  133.  Danish, Dutch, English, Faeroese, Finnish, French, German, Icelandic,
  134.  Irish, Italian, Norwegian, Portuguese, Spanish, and Swedish.
  135. " . describe-european-environment-map))
  136.          ))
  137.  
  138. (set-language-info-alist
  139.  "French" '((setup-function . (setup-latin1-environment
  140.                 . setup-european-environment-map))
  141.          (charset . (ascii latin-iso8859-1))
  142.          (coding-system . (iso-8859-1))
  143.          (tutorial . "TUTORIAL.fr")
  144.          (sample-text
  145.           . "Hello, Hej, Tere, Hei, Bonjour, Gr,A|_(B Gott, Ciao, ,A!(BHola!")
  146.          (documentation . ("\
  147. These languages are supported with the Latin-1 (ISO-8859-1) character set:
  148.  Danish, Dutch, English, Faeroese, Finnish, French, German, Icelandic,
  149.  Irish, Italian, Norwegian, Portuguese, Spanish, and Swedish.
  150. " . describe-european-environment-map))
  151.          ))
  152.  
  153. (set-language-info-alist
  154.  "Norwegian" '((setup-function . (setup-latin1-environment
  155.                 . setup-european-environment-map))
  156.          (charset . (ascii latin-iso8859-1))
  157.          (coding-system . (iso-8859-1))
  158.          (tutorial . "TUTORIAL.no")
  159.          (sample-text
  160.           . "Hello, Hej, Tere, Hei, Bonjour, Gr,A|_(B Gott, Ciao, ,A!(BHola!")
  161.          (documentation . ("\
  162. These languages are supported with the Latin-1 (ISO-8859-1) character set:
  163.  Danish, Dutch, English, Faeroese, Finnish, French, German, Icelandic,
  164.  Irish, Italian, Norwegian, Portuguese, Spanish, and Swedish.
  165. " . describe-european-environment-map))
  166.          ))
  167.  
  168. ;; Latin-2 (ISO-8859-2)
  169.  
  170. ;; (make-coding-system
  171. ;;  'iso-latin-2 2 ?2
  172. ;;  "ISO 2022 based 8-bit encoding (MIME:ISO-8859-2)"
  173. ;;  '((ascii t) (latin-iso8859-2 t) nil nil
  174. ;;    nil ascii-eol ascii-cntl nil nil nil nil))
  175.  
  176. ;; (define-coding-system-alias 'iso-8859-2 'iso-latin-2)
  177. ;; (define-coding-system-alias 'latin-2 'iso-latin-2)
  178.  
  179. (make-coding-system
  180.  'iso-8859-2 'iso2022 "MIME ISO-8859-2"
  181.  '(charset-g0 ascii
  182.    charset-g1 latin-iso8859-2
  183.    charset-g2 t
  184.    charset-g3 t
  185.    mnemonic "MIME/Ltn-2"
  186.    ))
  187.  
  188. (defun setup-latin2-environment ()
  189.   "Set up multilingual environment (MULE) for European Latin-2 users."
  190.   (interactive)
  191.   (setup-8-bit-environment "Latin-2" 'latin-iso8859-2 'iso-8859-2
  192.                "latin-2-prefix"))
  193.  
  194. (set-language-info-alist
  195.  "Latin-2" '((setup-function . (setup-latin2-environment
  196.                 . setup-european-environment-map))
  197.          (charset . (ascii latin-iso8859-2))
  198.          (coding-system . (iso-8859-2))
  199.          (documentation . ("\
  200. These languages are supported with the Latin-2 (ISO-8859-2) character set:
  201.  Albanian, Czech, English, German, Hungarian, Polish, Romanian,
  202.  Serbian, Croatian, Slovak, Slovene, and Swedish.
  203. " . describe-european-environment-map))
  204.          ))
  205.  
  206. (set-language-info-alist
  207.  "Croatian" '((setup-function . (setup-latin2-environment
  208.                 . setup-european-environment-map))
  209.           (charset . (ascii latin-iso8859-2))
  210.           (tutorial . "TUTORIAL.hr")
  211.           (coding-system . (iso-8859-2))
  212.           (documentation . ("\
  213. These languages are supported with the Latin-2 (ISO-8859-2) character set:
  214.  Albanian, Czech, English, German, Hungarian, Polish, Romanian,
  215.  Serbian or Croatian, Slovak, Slovene, and Swedish.
  216. " . describe-european-environment-map))
  217.           ))
  218. (set-language-info-alist
  219.  "Polish" '((setup-function . (setup-latin2-environment
  220.                 . setup-european-environment-map))
  221.           (charset . (ascii latin-iso8859-2))
  222.           (tutorial . "TUTORIAL.pl")
  223.           (coding-system . (iso-8859-2))
  224.           (documentation . ("\
  225. These languages are supported with the Latin-2 (ISO-8859-2) character set:
  226.  Albanian, Czech, English, German, Hungarian, Polish, Romanian, 
  227.  Serbian or Croatian, Slovak, Slovene, and Swedish.
  228. " . describe-european-environment-map))
  229.           ))
  230.  
  231.  
  232. ;; Latin-3 (ISO-8859-3)
  233.  
  234. ;; (make-coding-system
  235. ;;  'iso-latin-3 2 ?3
  236. ;;  "ISO 2022 based 8-bit encoding (MIME:ISO-8859-3)"
  237. ;;  '((ascii t) (latin-iso8859-3 t) nil nil
  238. ;;    nil ascii-eol ascii-cntl nil nil nil nil))
  239.  
  240. ;; (define-coding-system-alias 'iso-8859-3 'iso-latin-3)
  241. ;; (define-coding-system-alias 'latin-3 'iso-latin-3)
  242.  
  243. (make-coding-system
  244.  'iso-8859-3 'iso2022 "MIME ISO-8859-3"
  245.  '(charset-g0 ascii
  246.    charset-g1 latin-iso8859-3
  247.    charset-g2 t
  248.    charset-g3 t
  249.    mnemonic "MIME/Ltn-3"
  250.    ))
  251.  
  252. (defun setup-latin3-environment ()
  253.   "Set up multilingual environment (MULE) for European Latin-3 users."
  254.   (interactive)
  255.   (setup-8-bit-environment "Latin-3" 'latin-iso8859-3 'iso-8859-3
  256.                "latin-3-prefix"))
  257.  
  258. (set-language-info-alist
  259.  "Latin-3" '((setup-function . (setup-latin3-environment
  260.                 . setup-european-environment-map))
  261.          (charset . (ascii latin-iso8859-3))
  262.          (coding-system . (iso-8859-3))
  263.          (documentation . ("\
  264. These languages are supported with the Latin-3 (ISO-8859-3) character set:
  265.  Afrikaans, Catalan, Dutch, English, Esperanto, French, Galician,
  266.  German, Italian, Maltese, Spanish, and Turkish.
  267. " . describe-european-environment-map))
  268.          ))
  269.  
  270. ;; Latin-4 (ISO-8859-4)
  271.  
  272. ;; (make-coding-system
  273. ;;  'iso-latin-4 2 ?4
  274. ;;  "ISO 2022 based 8-bit encoding (MIME:ISO-8859-4)"
  275. ;;  '((ascii t) (latin-iso8859-4 t) nil nil
  276. ;;    nil ascii-eol ascii-cntl nil nil nil nil))
  277.  
  278. ;; (define-coding-system-alias 'iso-8859-4 'iso-latin-4)
  279. ;; (define-coding-system-alias 'latin-4 'iso-latin-4)
  280.  
  281. (make-coding-system
  282.  'iso-8859-4 'iso2022 "MIME ISO-8859-4"
  283.  '(charset-g0 ascii
  284.    charset-g1 latin-iso8859-4
  285.    charset-g2 t
  286.    charset-g3 t
  287.    mnemonic "MIME/Ltn-4"
  288.    ))
  289.  
  290. (defun setup-latin4-environment ()
  291.   "Set up multilingual environment (MULE) for European Latin-4 users."
  292.   (interactive)
  293.   (setup-8-bit-environment "Latin-4" 'latin-iso8859-4 'iso-8859-4
  294.                "latin-4-prefix"))
  295.  
  296. (set-language-info-alist
  297.  "Latin-4" '((setup-function . (setup-latin4-environment
  298.                 . setup-european-environment-map))
  299.          (charset . (ascii latin-iso8859-4))
  300.          (coding-system . (iso-8859-4))
  301.          (documentation . ("\
  302. These languages are supported with the Latin-4 (ISO-8859-4) character set:
  303.  Danish, English, Estonian, Finnish, German, Greenlandic, Lappish,
  304.  Latvian, Lithuanian, and Norwegian.
  305. " . describe-european-environment-map))
  306.          ))
  307.  
  308. ;; Latin-5 (ISO-8859-9)
  309.  
  310. ;; (make-coding-system
  311. ;;  'iso-latin-5 2 ?9
  312. ;;  "ISO 2022 based 8-bit encoding (MIME:ISO-8859-9)"
  313. ;;  '((ascii t) (latin-iso8859-9 t) nil nil
  314. ;;    nil ascii-eol ascii-cntl nil nil nil nil))
  315.  
  316. ;; (define-coding-system-alias 'iso-8859-9 'iso-latin-5)
  317. ;; (define-coding-system-alias 'latin-5 'iso-latin-5)
  318.  
  319. (make-coding-system
  320.  'iso-8859-9 'iso2022 "MIME ISO-8859-9"
  321.  '(charset-g0 ascii
  322.    charset-g1 latin-iso8859-9
  323.    charset-g2 t
  324.    charset-g3 t
  325.    mnemonic "MIME/Ltn-5"
  326.    ))
  327.  
  328. (defun setup-latin5-environment ()
  329.   "Set up multilingual environment (MULE) for European Latin-5 users."
  330.   (interactive)
  331.   (setup-8-bit-environment "Latin-5" 'latin-iso8859-9 'iso-8859-5
  332.                "latin-5-prefix"))
  333.  
  334. (set-language-info-alist
  335.  "Latin-5" '((setup-function . (setup-latin5-environment
  336.                 . setup-european-environment-map))
  337.          (charset . (ascii latin-iso8859-9))
  338.          (coding-system . (iso-8859-5))
  339.          (documentation . ("\
  340. These languages are supported with the Latin-5 (ISO-8859-9) character set.
  341. " . describe-european-environment-map))
  342.          ))
  343.  
  344. ;; (defun setup-european-environment ()
  345. ;;   "Setup multilingual environment (MULE) for European languages users.
  346. ;; It actually reset MULE to the default status, and
  347. ;; set quail-latin-1 as the default input method to be selected.
  348. ;; See also the documentation of setup-english-environment."
  349. ;;   (setup-english-environment)
  350. ;;   (setq default-input-method '("European" . "quail-latin-1")))
  351.  
  352. ;; (defun describe-european-support ()
  353. ;;   "Describe how Emacs support European languages."
  354. ;;   (interactive)
  355. ;;   (describe-language-support-internal "European"))
  356.  
  357. ;; (set-language-info-alist
  358. ;;  "European" '((setup-function . setup-european-environment)
  359. ;;               (describe-function . describe-european-support)
  360. ;;               (charset . (ascii latin-iso8859-1 latin-iso8859-2
  361. ;;                           latin-iso8859-3 latin-iso8859-4 latin-iso8859-9))
  362. ;;               (coding-system . (iso-8859-1 iso-8859-2 iso-8859-3
  363. ;;                                 iso-8859-4 iso-8859-9))
  364. ;;               (sample-text
  365. ;;                . "Hello, Hej, Tere, Hei, Bonjour, Gr,A|_(B Gott, Ciao, ,A!(BHola!")
  366. ;;               (documentation . "\
  367. ;; Almost all of European languages are supported by the character sets and
  368. ;; coding systems listed below.
  369. ;; To input them, LEIM (Libraries for Emacs Input Methods) should have been
  370. ;; installed.")
  371. ;;               ))
  372.  
  373. ;;; european.el ends here
  374.